home *** CD-ROM | disk | FTP | other *** search
- (*
- This has been tested on a CASE 4624/V and a Robotics Courier 2400
-
- THIS HAS NOT BEEN DEBUGGED and I am not great with communications.
- It is just that I had to search for days to find a simple way
- to make one of my programs dial out on a modem, and I have used Compu
- Serve so many times for other ideas but could find nothing for this.
- So I should share this with others.
-
- After many days of searching the answer turned out to be really simple
- and this is it.
-
-
- This is a small procedure that will enable you to use your modem as a dialer
- it uses Intr 14h to set the modem parameters and the built in TP array Port
- to write the Hayes AT Command set to the com port.
-
-
- -----------------------------------------------------------------------------
- The bits of the AL register are as follows for serial initialization
-
- 7,6,5 4,3 2 1,0
- Baud Rate Parity Stop Bits Word Length
-
- 000 = 110 00 = none 0 = 1 bit 10 = 7 bits
- 001 = 150 01 = odd 1 = 2 bits 11 = 8 bits
- 010 = 300 10 = none
- 011 = 600 11 = even
- 100 = 1200
- 101 = 2400
- 110 = 4800
- 111 = 9600
-
- For 2400 Baud, Even Parity, 1 Stop and 7 bits
-
- you would load Binary 101 11 0 10 into the AL register
- and 10111010 equals BA in hex
-
- -----------------------------------------------------------------------------
-
- Port is a TP build in array for accessing the COM ports
-
- so " Port[$3F8] := Ord('A'); " sends the character 'A' to COM1
- or " Ch := Chr(Port[$3F8]); " reads a character from COM1
-
- Addresses are
-
- 3F8h = COM1
- 2F8h = COM2
- 3E8h = COM3
- 2E8h = COM4
-
- -----------------------------------------------------------------------------
-
- Calling Interupt $14 will access the Serial Port. The function depends
- on what is in the AH register
- { DX Holds The COM Port Number : 0 = COM1, 1 = COM2, 2 = COM3 and 3 = COM4 }
-
- AH = 0 Sets serial port parameters
- AH = 1 Outputs Character to serial port
- AH = 2 Inputs character from serial port
- AH = 3 Returns Status information about a serial port
-
-
- I Just Use Function 0 to set up the Serial Port
-
-
- *)
-
-
- Program Dialer;
-
- Uses Dos,Crt;
-
- Var TestNumber : String;
-
-
- Procedure SendModemStr(ModemStr : String);
-
-
- var
- I : Integer;
- Regs : Registers;
-
- begin
- regs.ah := 0; (* Set Serial Port Parameters *)
- Regs.al := $BA; (* Set To 8, 1, Even at 2400 Baud *)
- regs.dx := $0; (* Set COM Port to COM1 *)
- Intr($14,Regs); (* Call Intr 14h to set these *)
- for i := 1 to Length(ModemStr) do
- begin
- Port[$3F8] := Ord(ModemStr[i]); (* Send Character to COM1 *)
- Delay(5); (* Delay Between Sends Because Speed *)
- end; (* of Computer is to Fast For Modem *)
-
- Delay(3000); (* Set so as not to miss key press *)
- writeln('Press any Key');
- Repeat Until ReadKey <> ''; (* Wait For Key Press *)
-
- ModemStr := 'ATH' + #13; (* Set and Send Hang Up Command *)
- for i := 1 to Length(ModemStr) do
- begin
- Port[$3F8] := Ord(ModemStr[i]); (* Send Hang Up Command to Modem *)
- Delay(5);
- end;
- end;
-
-
- begin
- (* Set Up Your Dialer Program Here *)
- TestNumber := '555 5555';
- SendModemStr('ATDT'+TestNumber+#13); (* Add AT Command ATDT which is Tone *)
- (* Dial and <CR> to Number String *)
- end.